import { init } from 'snabbdom/build/package/init'
import { h } from 'snabbdom/build/package/h'

// 1. 导入模块
import { styleModule } from 'snabbdom/build/package/modules/style'
import { eventListenersModule } from 'snabbdom/src/package/modules/eventlisteners'
// 2. 注册模块
let patch = init([
    styleModule,
    eventListenersModule
])
// 3. h函数的第二个参数 传入模块中使用的数据（对象）
let vnode = h('div', [
    h('h1', { style: { backgroundColor: 'red' } }, 'hello world'),
    h('p', { on: { click: eventHandler } }, 'hello p')
])

function eventHandler() {
    console.log('not to do')
}

let app = document.querySelector('#app')
patch(app, vnode)

